package com.ycl.bookstore.controller;

import com.ycl.bookstore.common.Result;
import com.ycl.bookstore.service.BalanceService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

import static net.sf.jsqlparser.util.validation.metadata.NamedObject.user;

@RestController
@RequestMapping("/me")
public class BalanceController {

    @Resource
    private BalanceService balanceService;

    @GetMapping("/balance")
    public Result getUserBalance(){
        return balanceService.getUserBalance();
    }

    @PostMapping("/recharge")
    public Result rechargeMoney(@RequestParam BigDecimal money){
        return balanceService.rechargeMoney(money);
    }

}
